//
//  DatasourceItem.swift
//  maozzi-rss
//
//  Created by 帽子 on 2020/7/18.
//  Copyright © 2020 帽子. All rights reserved.
//  数据源model

import SwiftUI

struct DatasourceItem: Codable, Identifiable, Hashable, Equatable {
    var id: Int
    // 数据源名称
    var name: String
    // 数据源logo
    var logo: String
    // 数据源url地址
    var rss_url: String
    // 时间日期格式
    var dateFormat: String

    static func == (lhs: DatasourceItem, rhs: DatasourceItem) -> Bool {
        return lhs.id == rhs.id
    }

    func encode() -> String {
        let encoder = JSONEncoder()
        return try! String(data: encoder.encode(self), encoding: .utf8)!
    }
}
